
	_unitposx = (_this select 0) select 0; //getpos _x select 0;
	_unitposy = (_this select 0) select 1; //getpos _x select 1;
	_unitposz = (_this select 0) select 2; //getpos _x select 2;

	_inside =false;
	_i = _this select 1; // Building object
	_dimensions = boundingBox _i;
	_WorldDimensionsMax = _i modelToWorld (_dimensions select 1);
	_WorldDimensionsMin = _i modelToWorld (_dimensions select 0);

	_xmin = _WorldDimensionsMin select 0;
	_ymin = _WorldDimensionsMin select 1;
	_zmin = _WorldDimensionsMin select 2;

	_zmax = _WorldDimensionsMax select 2;
	_ymax = _WorldDimensionsMax select 1;
	_xmax = _WorldDimensionsMax select 0;
	if (_xmin>_xmax) then {_xt=_xmin;_xmin=_xmax;_xmax=_xt;};
	if (_ymin>_ymax) then {_yt=_ymin;_ymin=_ymax;_ymax=_yt;};

	if (((_unitposx > _xmin) && (_unitposx < _xmax)) && ((_unitposy > _ymin) && (_unitposy < _ymax)) && ((_unitposz > _zmin) && (_unitposz < _zmax))) then {
		// unit is in building
		_inside =true;
	};
_inside
